package com.undsf.despot.templates.impl;

import com.undsf.despot.modles.Monster;
import com.undsf.despot.templates.MonsterTemplateBase;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * 怪物模板
 * Created by Arathi on 2016/10/3.
 */
public class MonsterTemplateXml extends MonsterTemplateBase {
    // XML辅助属性
    protected String image;
    protected String number;

    protected String resistance_gira;     // 火焰抗性
    protected String resistance_rariho;   // 催眠抗性
    protected String resistance_mahoton;  // 沉默抗性
    protected String resistance_zaraki;   // 气绝抗性
    protected String resistance_manusa;   // 致盲抗性
    protected String resistance_rukanan;  // 削甲抗性

    protected String action1;
    protected String action2;
    protected String action3;
    protected String action4;
    protected String action5;
    protected String action6;
    protected String action7;
    protected String action8;

    protected String action_mode;

    public void convert() {
        id = Integer.parseInt(number.substring(3));

        resistances = new HashMap<String, Integer>();
        int gira = Integer.parseInt(resistance_gira.substring(0,1));
        int rariho = Integer.parseInt(resistance_rariho.substring(0,1));
        int mahoton = Integer.parseInt(resistance_mahoton.substring(0,1));
        int zaraki = Integer.parseInt(resistance_zaraki.substring(0,1));
        int manusa = Integer.parseInt(resistance_manusa.substring(0,1));
        int rukanan = Integer.parseInt(resistance_rukanan.substring(0,1));
        resistances.put("gira", gira);
        resistances.put("rariho", rariho);
        resistances.put("mahoton", mahoton);
        resistances.put("zaraki", zaraki);
        resistances.put("manusa", manusa);
        resistances.put("rukanan", rukanan);

        actions = new ArrayList<String>();
        actions.add(action1);
        actions.add(action2);
        actions.add(action3);
        actions.add(action4);
        actions.add(action5);
        actions.add(action6);
        actions.add(action7);
        actions.add(action8);

        actionMode = (action_mode.equals("随机")) ? Monster.ACTION_MODE_RANDOM : Monster.ACTION_MODE_SEQUENCE;
    }

    public boolean check() {
        return true;
    }
}
